
//人物移动请求 {"y":122,"x":227}

// @ts-ignore
export async function execute(client_id, message_json) {
    let login_characters = G.Characters.get_current_login_characters(client_id);
    let is_move = G.MapUtils.is_move(login_characters["id"]);

    if (is_move) {
        //通知地图内其他玩家在移动
        if (login_characters["队伍"] === 0 || login_characters["队长"]) {
            let map_data = G.MapUtils.get_map_data(login_characters["地图数据"]["编号"]);
            // console.debug(`地图${login_characters["地图数据"]["编号"]}内还有玩家${map_data.size}人`)
            map_data.forEach((value, key) => {
                let map_characters_id = value["id"];
                if (value["类型"] === "玩家" && Number(map_characters_id) !== Number(login_characters["id"])) {
                    let characters_client_id = G.Characters.get_characters_client_id(map_characters_id);
                    if (characters_client_id !== undefined) {
                        let send_data = {
                            "id": login_characters["id"],
                            "路径": {
                                "x": message_json["x"],
                                "y": message_json["y"],
                                "距离": 0,
                            }
                        };
                        ClientUtils.send_client_message(characters_client_id, 1008, send_data);
                    }
                }
            })
        }
    }
}
